package com.example.springapplicationdemo.exception;

import lombok.Data;

import java.util.Date;

/**
 * 继承在RuntimeException，为不受检查异常<br />
 *
 *
 */
@Data
public abstract class BusinessException extends RuntimeException{
    /**
     * 异常处理码
     */
    private final int code;

    /**
     * 异常消息
     */
    private final String msg;

    private final String timestamp = String.valueOf(System.currentTimeMillis());

    protected BusinessException(int code, String msg){
        this.code = code;
        this.msg = msg;
    }

    protected BusinessException(int code, String msg, Exception e) {
        super(e);
        this.code = code;
        this.msg = msg;
    }
}
